/**
 * 
 */
package s2h.controller;

import org.hibernate.classic.Session;

import s2h.hibernate.util.HibernateUtil;
import s2h.model.UserModel;

/**
 * @author WIN7
 *
 */
public class UserController {
	
	public boolean doLogin(UserModel user)
	{
		if (user.getUsername().equals("admin") && user.getPassword().equals("admin"))
		{
			return true;
		}else
		{
			return false;
		}
		
	}
	public UserModel add(UserModel user) {
		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
		session.beginTransaction();
		session.save(user);
		session.getTransaction().commit();
		return user;
	}
	public void createUsers()
	{
		UserModel user = new UserModel();
		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
		session.beginTransaction();
		session.save(user);
		session.getTransaction().commit();
	}

}
